home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 43 / Amiga Format CD43 (1999)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-09].iso / -serious- / programming / basic / mildred / lha / ilbmviewer.lha / ILBMviewer.ascii < prev    next >
Text File  |  1999-03-07  |  2KB  |  82 lines

  1. WBStartup
  2.  
  3. ;Main
  4.  
  5. DEFTYPE.w
  6.  
  7. INCLUDE "Prefs.bb2"
  8. INCLUDE "Variables.bb2"
  9. INCLUDE "Chunky.bb2"
  10. INCLUDE "Display.bb2"
  11.  
  12. MReservec2pWindows 4
  13. MReserveBitmaps 3
  14.  
  15. MaxLen ASLfile$=256
  16. MaxLen ASLpath$=256
  17. ASLpath$="Data:Pictures/IFF1"
  18. FindScreen 0
  19. Land$=ASLFileRequest$("Choose an ILBM picture)",ASLpath$,ASLfile$)
  20. If InitLand{Land$,0,0,0}=False Then Goto Finish
  21. YOff.l=(LandHeight-ILBMActualHeight)*LandWidth
  22. ChunkyCopy16{LandBuffer+YOff,LandBuffer2+YOff,ILBMActualHeight,CPUminimum,LandWidth,LandWidth} ; Duplicate
  23. If InitDisplay{"Game"}=False Then Goto Finish
  24. ShowPalette 0
  25. Multitasking{On}
  26. buf.b=0
  27. its.l=0
  28. *Scr._Screen=Peek.l(Addr Screen(0))
  29. xmult.q=(LandWidth-PrefDisplayWidth)/PrefDisplayWidth
  30. ymult.q=(LandHeight-PrefDisplayHeight)/PrefDisplayHeight
  31. LandX.w=0
  32. LandY.w=0
  33. MemOffset.l=0
  34. Mc2pWindow 0,PrefDisplayWidth,PrefDisplayHeight,LandWidth,CPUminimum,PrefDisplayWidth,PrefDisplayHeight
  35.  
  36. MCPU CPUminimum
  37. Mc2pCPUmode CPUminimum
  38. ResetTimer
  39. While Joyb(0)<>1 AND Joyb(1)=0
  40.  
  41.   If PrefDisplayBuffering>1
  42.     buf+1
  43.     If buf=PrefDisplayBuffering Then buf=0
  44.   EndIf
  45.  
  46.   LandX.w=SMouseX*xmult
  47.   LandY.w=SMouseY*ymult
  48.  
  49.   If IsAGA
  50.     Mc2p c2pLaceMode,MBitmapPtr(LandX,LandY),PlanarBuf(buf)
  51.     ShowBitMap buf
  52.   Else
  53.     *RP._RastPort=RastPort(buf)
  54.     For Y=0 To PrefDisplayHeight-1
  55.       WritePixelLine8_ *RP,0,Y,PrefDisplayWidth-1,MBitmapPtr(LandX,LandY+Y),0
  56.     Next Y
  57.     *ScrVP\DyOffset=BufNum*PrefDisplayHeight
  58.     ScrollVPort_ *ScrVP
  59.   EndIf
  60.  
  61.   its+1
  62. Wend
  63. t=Timer
  64. t=Max(t,1)
  65. its=Max(its,1)
  66. a.q=50.0/(t/its)
  67. ScreenToBack_ NPeekL(Addr Screen(0))
  68. VWait 50
  69. FindScreen 1
  70. Window 2,16,16,300,40,0,"Test results",1,0
  71. WindowOutput 2
  72. NPrint a," frames per second"
  73. NPrint " "
  74. NPrint "Press mouse/joy button..."
  75. Repeat
  76. Until Joyb(0)<>0 OR Joyb(1)<>0
  77.  
  78. Finish:
  79. Multitasking{On}
  80. End
  81.  
  82.